<?php

class D_Plugin_ErrorHandle extends Zend_Controller_Plugin_Abstract{
	public function __construct()
    {
       
    }
    
	public function routeShutdown (Zend_Controller_Request_Abstract $request)
    {
    	if($this->getResponse()->isException()){
    		echo "ex";
    	}
    	//var_dump($this->getResponse()->getException());
        $front = Zend_Controller_Front::getInstance();
        if (! ($front->getPlugin('Zend_Controller_Plugin_ErrorHandler') instanceof Zend_Controller_Plugin_ErrorHandler))
            return;
            
        $error = $front->getPlugin('Zend_Controller_Plugin_ErrorHandler');
        $testRequest = new Zend_Controller_Request_HTTP();
        $testRequest->setModuleName($request->getModuleName())
            ->setControllerName($error->getErrorHandlerController())
            ->setActionName($error->getErrorHandlerAction());
        if ($front->getDispatcher()->isDispatchable($testRequest)) {
        	//echo $request->getModuleName();
            $error->setErrorHandlerModule($request->getModuleName());
            Zend_Loader::loadClass("ErrorController","./application/modules/userCo/controllers");
            $errorController = new ErrorController($request, $this->getResponse());
            $errorController->errorAction('error_params');
        }
    }
     
	
}

?>